/***************************************************************************
 * 
 * Copyright (c) 2012 baidu.com, Inc. All Rights Reserved
 * $Id$ 
 * 
 **************************************************************************/
 
 
 
/**
 * @file status.cc
 * @author Yuncong Zhang(zhangyuncong@baidu.com)
 * @date 2012/09/29 10:31:53
 * @version 1.0 
 * @brief 
 *  
 **/

#include <cstdio>
#include <unistd.h>
#include <sys/wait.h>
#include <cstdlib>
int main(int argc,char** argv){
	if (argc < 2){
		printf("usage: %s status_code\n","status");
		exit(-1);
	}
	int status = atoi(argv[1]);
	if (WIFEXITED(status)){
		printf("nomarl exited with return value [%d]\n",WEXITSTATUS(status));
	}else if (WIFSIGNALED(status)){
		printf("killed by signal [%d]\n",WTERMSIG(status));
	}else if(WIFSTOPPED(status)){
		printf("stopped by signal [%d]\n,child process should not exit.\n",WSTOPSIG(status));
	}
	fflush(stdout);
}




















/* vim: set ts=4 sw=4 sts=4 tw=100 noet: */
